$(function () {

    var edit_dialog =  $('#edit_dialog');
    var edit_form =  $('#edit_form');
    var all_datagrid =  $('#all_datagrid');

    //数据表格
    all_datagrid.datagrid({
        url:'/transferRecord/list.do',
        striped:true,
        singleSelect:true,
        pagination:true,
        rownumbers:true,
        toolbar:"#tb",
        columns:[[
            {field:'id',hidden:true,width:100},
            {field:'client1',title:'姓名',width:100,formatter:function (value,row,index) {
                    console.log(row);
                    return row.client ? row.client.name: "";
                }},
            {field:'client2',title:'当前客户QQ号',formatter:function (value,row,index) {
                    return row.client ? row.client.qqNum: "";
                }},
            {field:'date',title:'操作时间',width:100},
            {field:'oleTracer',title:'原跟踪人',width:100,formatter:function (value,row,index) {
                     return row.oldTracer ? row.oldTracer.username: "";
                }},
            {field:'newTracer',title:'现跟踪人',width:100,formatter:function (value,row,index) {
                     return row.newTracer ? row.newTracer.username: "";
            }}
        ]]
    });
    //end


    var cmdObj = {

        //刷新
        reload :function () {
            all_datagrid.datagrid("reload");
        }
    }

    //抽取优化
    $("a[data-cmd]").click(function () {
        var cmd = $(this).data("cmd");

        cmdObj[cmd]();
    })
    //end


    //dialog弹窗
    $('#edit_dialog').dialog({
        title: 'My Dialog',
        buttons:"#bb",
        closed:true,
        width: "60%",
        height: "80%"
    });
    //end

})//end